3.8.1 \(\int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx\) [701]

3.8.1.1 Optimal result
3.8.1.2 Mathematica [A] (verified)
3.8.1.3 Rubi [A] (verified)
3.8.1.4 Maple [F]
3.8.1.5 Fricas [F]
3.8.1.6 Sympy [F]
3.8.1.7 Maxima [F]
3.8.1.8 Giac [F]
3.8.1.9 Mupad [F(-1)]

3.8.1.1 Optimal result

Integrand size = 23, antiderivative size = 252 \[ \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\frac {\left (a^2-b^2\right ) \operatorname {Hypergeometric2F1}\left (1,\frac {1+n}{2},\frac {3+n}{2},-\tan ^2(e+f x)\right ) (d \tan (e+f x))^{1+n}}{\left (a^2+b^2\right )^2 d f (1+n)}+\frac {b^2 \left (a^2 (2-n)-b^2 n\right ) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,-\frac {b \tan (e+f x)}{a}\right ) (d \tan (e+f x))^{1+n}}{a^2 \left (a^2+b^2\right )^2 d f (1+n)}-\frac {2 a b \operatorname {Hypergeometric2F1}\left (1,\frac {2+n}{2},\frac {4+n}{2},-\tan ^2(e+f x)\right ) (d \tan (e+f x))^{2+n}}{\left (a^2+b^2\right )^2 d^2 f (2+n)}+\frac {b^2 (d \tan (e+f x))^{1+n}}{a \left (a^2+b^2\right ) d f (a+b \tan (e+f x))} \]

output
(a^2-b^2)*hypergeom([1, 1/2+1/2*n],[3/2+1/2*n],-tan(f*x+e)^2)*(d*tan(f*x+e 
))^(1+n)/(a^2+b^2)^2/d/f/(1+n)+b^2*(a^2*(2-n)-b^2*n)*hypergeom([1, 1+n],[2 
+n],-b*tan(f*x+e)/a)*(d*tan(f*x+e))^(1+n)/a^2/(a^2+b^2)^2/d/f/(1+n)-2*a*b* 
hypergeom([1, 1+1/2*n],[2+1/2*n],-tan(f*x+e)^2)*(d*tan(f*x+e))^(2+n)/(a^2+ 
b^2)^2/d^2/f/(2+n)+b^2*(d*tan(f*x+e))^(1+n)/a/(a^2+b^2)/d/f/(a+b*tan(f*x+e 
))
 
3.8.1.2 Mathematica [A] (verified)

Time = 1.81 (sec) , antiderivative size = 204, normalized size of antiderivative = 0.81 \[ \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\frac {\tan (e+f x) (d \tan (e+f x))^n \left (-\frac {b^2 \left (a^2 (-2+n)+b^2 n\right ) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,-\frac {b \tan (e+f x)}{a}\right )}{a \left (a^2+b^2\right ) (1+n)}+\frac {b^2}{a+b \tan (e+f x)}+\frac {a \left (\left (a^2-b^2\right ) (2+n) \operatorname {Hypergeometric2F1}\left (1,\frac {1+n}{2},\frac {3+n}{2},-\tan ^2(e+f x)\right )-2 a b (1+n) \operatorname {Hypergeometric2F1}\left (1,\frac {2+n}{2},\frac {4+n}{2},-\tan ^2(e+f x)\right ) \tan (e+f x)\right )}{\left (a^2+b^2\right ) (1+n) (2+n)}\right )}{a \left (a^2+b^2\right ) f} \]

input
Integrate[(d*Tan[e + f*x])^n/(a + b*Tan[e + f*x])^2,x]
 
output
(Tan[e + f*x]*(d*Tan[e + f*x])^n*(-((b^2*(a^2*(-2 + n) + b^2*n)*Hypergeome 
tric2F1[1, 1 + n, 2 + n, -((b*Tan[e + f*x])/a)])/(a*(a^2 + b^2)*(1 + n))) 
+ b^2/(a + b*Tan[e + f*x]) + (a*((a^2 - b^2)*(2 + n)*Hypergeometric2F1[1, 
(1 + n)/2, (3 + n)/2, -Tan[e + f*x]^2] - 2*a*b*(1 + n)*Hypergeometric2F1[1 
, (2 + n)/2, (4 + n)/2, -Tan[e + f*x]^2]*Tan[e + f*x]))/((a^2 + b^2)*(1 + 
n)*(2 + n))))/(a*(a^2 + b^2)*f)
 
3.8.1.3 Rubi [A] (verified)

Time = 1.31 (sec) , antiderivative size = 259, normalized size of antiderivative = 1.03, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.478, Rules used = {3042, 4052, 3042, 4136, 3042, 4021, 3042, 3957, 278, 4117, 74}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2}dx\)

\(\Big \downarrow \) 4052

\(\displaystyle \frac {\int \frac {(d \tan (e+f x))^n \left (-b^2 d n \tan ^2(e+f x)-a b d \tan (e+f x)+d \left (a^2-b^2 n\right )\right )}{a+b \tan (e+f x)}dx}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {(d \tan (e+f x))^n \left (-b^2 d n \tan (e+f x)^2-a b d \tan (e+f x)+d \left (a^2-b^2 n\right )\right )}{a+b \tan (e+f x)}dx}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 4136

\(\displaystyle \frac {\frac {b^2 d \left (a^2 (2-n)-b^2 n\right ) \int \frac {(d \tan (e+f x))^n \left (\tan ^2(e+f x)+1\right )}{a+b \tan (e+f x)}dx}{a^2+b^2}+\frac {\int (d \tan (e+f x))^n \left (a \left (a^2-b^2\right ) d-2 a^2 b d \tan (e+f x)\right )dx}{a^2+b^2}}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {b^2 d \left (a^2 (2-n)-b^2 n\right ) \int \frac {(d \tan (e+f x))^n \left (\tan (e+f x)^2+1\right )}{a+b \tan (e+f x)}dx}{a^2+b^2}+\frac {\int (d \tan (e+f x))^n \left (a \left (a^2-b^2\right ) d-2 a^2 b d \tan (e+f x)\right )dx}{a^2+b^2}}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 4021

\(\displaystyle \frac {\frac {b^2 d \left (a^2 (2-n)-b^2 n\right ) \int \frac {(d \tan (e+f x))^n \left (\tan (e+f x)^2+1\right )}{a+b \tan (e+f x)}dx}{a^2+b^2}+\frac {a d \left (a^2-b^2\right ) \int (d \tan (e+f x))^ndx-2 a^2 b \int (d \tan (e+f x))^{n+1}dx}{a^2+b^2}}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {b^2 d \left (a^2 (2-n)-b^2 n\right ) \int \frac {(d \tan (e+f x))^n \left (\tan (e+f x)^2+1\right )}{a+b \tan (e+f x)}dx}{a^2+b^2}+\frac {a d \left (a^2-b^2\right ) \int (d \tan (e+f x))^ndx-2 a^2 b \int (d \tan (e+f x))^{n+1}dx}{a^2+b^2}}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 3957

\(\displaystyle \frac {\frac {\frac {a d^2 \left (a^2-b^2\right ) \int \frac {(d \tan (e+f x))^n}{\tan ^2(e+f x) d^2+d^2}d(d \tan (e+f x))}{f}-\frac {2 a^2 b d \int \frac {(d \tan (e+f x))^{n+1}}{\tan ^2(e+f x) d^2+d^2}d(d \tan (e+f x))}{f}}{a^2+b^2}+\frac {b^2 d \left (a^2 (2-n)-b^2 n\right ) \int \frac {(d \tan (e+f x))^n \left (\tan (e+f x)^2+1\right )}{a+b \tan (e+f x)}dx}{a^2+b^2}}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 278

\(\displaystyle \frac {\frac {b^2 d \left (a^2 (2-n)-b^2 n\right ) \int \frac {(d \tan (e+f x))^n \left (\tan (e+f x)^2+1\right )}{a+b \tan (e+f x)}dx}{a^2+b^2}+\frac {\frac {a \left (a^2-b^2\right ) (d \tan (e+f x))^{n+1} \operatorname {Hypergeometric2F1}\left (1,\frac {n+1}{2},\frac {n+3}{2},-\tan ^2(e+f x)\right )}{f (n+1)}-\frac {2 a^2 b (d \tan (e+f x))^{n+2} \operatorname {Hypergeometric2F1}\left (1,\frac {n+2}{2},\frac {n+4}{2},-\tan ^2(e+f x)\right )}{d f (n+2)}}{a^2+b^2}}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 4117

\(\displaystyle \frac {\frac {b^2 d \left (a^2 (2-n)-b^2 n\right ) \int \frac {(d \tan (e+f x))^n}{a+b \tan (e+f x)}d\tan (e+f x)}{f \left (a^2+b^2\right )}+\frac {\frac {a \left (a^2-b^2\right ) (d \tan (e+f x))^{n+1} \operatorname {Hypergeometric2F1}\left (1,\frac {n+1}{2},\frac {n+3}{2},-\tan ^2(e+f x)\right )}{f (n+1)}-\frac {2 a^2 b (d \tan (e+f x))^{n+2} \operatorname {Hypergeometric2F1}\left (1,\frac {n+2}{2},\frac {n+4}{2},-\tan ^2(e+f x)\right )}{d f (n+2)}}{a^2+b^2}}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

\(\Big \downarrow \) 74

\(\displaystyle \frac {\frac {\frac {a \left (a^2-b^2\right ) (d \tan (e+f x))^{n+1} \operatorname {Hypergeometric2F1}\left (1,\frac {n+1}{2},\frac {n+3}{2},-\tan ^2(e+f x)\right )}{f (n+1)}-\frac {2 a^2 b (d \tan (e+f x))^{n+2} \operatorname {Hypergeometric2F1}\left (1,\frac {n+2}{2},\frac {n+4}{2},-\tan ^2(e+f x)\right )}{d f (n+2)}}{a^2+b^2}+\frac {b^2 \left (a^2 (2-n)-b^2 n\right ) (d \tan (e+f x))^{n+1} \operatorname {Hypergeometric2F1}\left (1,n+1,n+2,-\frac {b \tan (e+f x)}{a}\right )}{a f (n+1) \left (a^2+b^2\right )}}{a d \left (a^2+b^2\right )}+\frac {b^2 (d \tan (e+f x))^{n+1}}{a d f \left (a^2+b^2\right ) (a+b \tan (e+f x))}\)

input
Int[(d*Tan[e + f*x])^n/(a + b*Tan[e + f*x])^2,x]
 
output
(b^2*(d*Tan[e + f*x])^(1 + n))/(a*(a^2 + b^2)*d*f*(a + b*Tan[e + f*x])) + 
((b^2*(a^2*(2 - n) - b^2*n)*Hypergeometric2F1[1, 1 + n, 2 + n, -((b*Tan[e 
+ f*x])/a)]*(d*Tan[e + f*x])^(1 + n))/(a*(a^2 + b^2)*f*(1 + n)) + ((a*(a^2 
 - b^2)*Hypergeometric2F1[1, (1 + n)/2, (3 + n)/2, -Tan[e + f*x]^2]*(d*Tan 
[e + f*x])^(1 + n))/(f*(1 + n)) - (2*a^2*b*Hypergeometric2F1[1, (2 + n)/2, 
 (4 + n)/2, -Tan[e + f*x]^2]*(d*Tan[e + f*x])^(2 + n))/(d*f*(2 + n)))/(a^2 
 + b^2))/(a*(a^2 + b^2)*d)
 

3.8.1.3.1 Defintions of rubi rules used

rule 74
Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[c^n*((b*x 
)^(m + 1)/(b*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*(x/c)], x] 
/; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[m] && (IntegerQ[n] || (GtQ[c, 0] 
 &&  !(EqQ[n, -2^(-1)] && EqQ[c^2 - d^2, 0] && GtQ[-d/(b*c), 0])))
 

rule 278
Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[a^p*(( 
c*x)^(m + 1)/(c*(m + 1)))*Hypergeometric2F1[-p, (m + 1)/2, (m + 1)/2 + 1, ( 
-b)*(x^2/a)], x] /; FreeQ[{a, b, c, m, p}, x] &&  !IGtQ[p, 0] && (ILtQ[p, 0 
] || GtQ[a, 0])
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3957
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b/d   Subst[Int 
[x^n/(b^2 + x^2), x], x, b*Tan[c + d*x]], x] /; FreeQ[{b, c, d, n}, x] && 
!IntegerQ[n]
 

rule 4021
Int[((b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Tan[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Tan[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x] && NeQ[c^ 
2 + d^2, 0] &&  !IntegerQ[2*m]
 

rule 4052
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*(a + b*Tan[e + f*x])^(m + 1)*((c 
+ d*Tan[e + f*x])^(n + 1)/(f*(m + 1)*(a^2 + b^2)*(b*c - a*d))), x] + Simp[1 
/((m + 1)*(a^2 + b^2)*(b*c - a*d))   Int[(a + b*Tan[e + f*x])^(m + 1)*(c + 
d*Tan[e + f*x])^n*Simp[a*(b*c - a*d)*(m + 1) - b^2*d*(m + n + 2) - b*(b*c - 
 a*d)*(m + 1)*Tan[e + f*x] - b^2*d*(m + n + 2)*Tan[e + f*x]^2, x], x], x] / 
; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] 
 && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && LtQ[m, -1] && (LtQ[n, 0] || Integ 
erQ[m]) &&  !(ILtQ[n, -1] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])))
 

rule 4117
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) 
+ (f_.)*(x_)])^(n_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> 
 Simp[A/f   Subst[Int[(a + b*x)^m*(c + d*x)^n, x], x, Tan[e + f*x]], x] /; 
FreeQ[{a, b, c, d, e, f, A, C, m, n}, x] && EqQ[A, C]
 

rule 4136
Int[(((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2))/((a_.) + (b_.)*tan[(e_.) 
+ (f_.)*(x_)]), x_Symbol] :> Simp[1/(a^2 + b^2)   Int[(c + d*Tan[e + f*x])^ 
n*Simp[b*B + a*(A - C) + (a*B - b*(A - C))*Tan[e + f*x], x], x], x] + Simp[ 
(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2)   Int[(c + d*Tan[e + f*x])^n*((1 + Tan[ 
e + f*x]^2)/(a + b*Tan[e + f*x])), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, 
 C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] & 
&  !GtQ[n, 0] &&  !LeQ[n, -1]
 
3.8.1.4 Maple [F]

\[\int \frac {\left (d \tan \left (f x +e \right )\right )^{n}}{\left (a +b \tan \left (f x +e \right )\right )^{2}}d x\]

input
int((d*tan(f*x+e))^n/(a+b*tan(f*x+e))^2,x)
 
output
int((d*tan(f*x+e))^n/(a+b*tan(f*x+e))^2,x)
 
3.8.1.5 Fricas [F]

\[ \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int { \frac {\left (d \tan \left (f x + e\right )\right )^{n}}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2}} \,d x } \]

input
integrate((d*tan(f*x+e))^n/(a+b*tan(f*x+e))^2,x, algorithm="fricas")
 
output
integral((d*tan(f*x + e))^n/(b^2*tan(f*x + e)^2 + 2*a*b*tan(f*x + e) + a^2 
), x)
 
3.8.1.6 Sympy [F]

\[ \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int \frac {\left (d \tan {\left (e + f x \right )}\right )^{n}}{\left (a + b \tan {\left (e + f x \right )}\right )^{2}}\, dx \]

input
integrate((d*tan(f*x+e))**n/(a+b*tan(f*x+e))**2,x)
 
output
Integral((d*tan(e + f*x))**n/(a + b*tan(e + f*x))**2, x)
 
3.8.1.7 Maxima [F]

\[ \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int { \frac {\left (d \tan \left (f x + e\right )\right )^{n}}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2}} \,d x } \]

input
integrate((d*tan(f*x+e))^n/(a+b*tan(f*x+e))^2,x, algorithm="maxima")
 
output
integrate((d*tan(f*x + e))^n/(b*tan(f*x + e) + a)^2, x)
 
3.8.1.8 Giac [F]

\[ \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int { \frac {\left (d \tan \left (f x + e\right )\right )^{n}}{{\left (b \tan \left (f x + e\right ) + a\right )}^{2}} \,d x } \]

input
integrate((d*tan(f*x+e))^n/(a+b*tan(f*x+e))^2,x, algorithm="giac")
 
output
integrate((d*tan(f*x + e))^n/(b*tan(f*x + e) + a)^2, x)
 
3.8.1.9 Mupad [F(-1)]

Timed out. \[ \int \frac {(d \tan (e+f x))^n}{(a+b \tan (e+f x))^2} \, dx=\int \frac {{\left (d\,\mathrm {tan}\left (e+f\,x\right )\right )}^n}{{\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^2} \,d x \]

input
int((d*tan(e + f*x))^n/(a + b*tan(e + f*x))^2,x)
 
output
int((d*tan(e + f*x))^n/(a + b*tan(e + f*x))^2, x)